﻿using LPLS.DBEntities.ConfigModels.DataCollectionConfigModule;
using LPLS.DBInterface.ConfigModels;
using Prism.Commands;
using Prism.Mvvm;
using System.Collections.ObjectModel;

namespace PropertyConfigModule.ViewModels
{
    public  class PropertyConfigViewModel : BindableBase
    {

        public DelegateCommand AddPropertyConfigCommand { get; }
        IPropertyConfigService __propertyConfigService;

        public PropertyConfigViewModel(IPropertyConfigService propertyConfigService) 
        {
            AddPropertyConfigCommand = new DelegateCommand(OpenFileDialog);

            __propertyConfigService = propertyConfigService;
            LoadData();
        }

        private void LoadData()
        {
            var data = __propertyConfigService.GetAll();
            PropertyConfigList = new ObservableCollection<BasePropertyConfig>(data);

        }


        private void OpenFileDialog() 
        {

            
        
        
        }
        //  PropertyConfigList
        private ObservableCollection<BasePropertyConfig> _PropertyConfigList;
        /// <summary>
        /// Property数据
        /// </summary>
        public ObservableCollection<BasePropertyConfig> PropertyConfigList
        {
            get { return _PropertyConfigList; }
            set
            {
                         
                    SetProperty(ref _PropertyConfigList, value);
            }
        }




        private BasePropertyConfig _SelectedPropertyConfig;

        public BasePropertyConfig SelectedPropertyConfig
        {
            get { return _SelectedPropertyConfig; }
            set {

                SetProperty(ref _SelectedPropertyConfig, value);

             
               }
        }



    }
}
